package day0116

import (
	"math/rand"
	"time"
)

/*

 */
type Solution struct {
	nums   []int
	origin []int
}

func Constructor(nums []int) Solution {
	rand.Seed(time.Now().UnixNano())
	tmp := make([]int, len(nums))
	copy(tmp, nums)
	return Solution{
		nums:   nums,
		origin: tmp,
	}
}

func (this *Solution) Reset() []int {
	return this.origin
}

func (this *Solution) Shuffle() []int {
	for i := 0; i < len(this.nums); i++ {
		r := rand.Intn(i + 1)
		this.nums[r], this.nums[i] = this.nums[i], this.nums[r]
	}
	return this.nums
}
